import request from '@/utils/request'
import { encrypt } from '@/utils/util'


export function login(username: string, password: string) {
  return request.post('/user/login', { username, password })
}

export function logout() {
  return request.post('/user/logout')
}

export function getInfo() {
  return request.get('/user/info')
}

// export function getCljjList(pageNO: number, pageSize: number, name: string, attribute: string,serverResourceType: string) {
//   return request.post('/cljj/list', { pageNO, pageSize,name,attribute,serverResourceType})
// }

// export function getCljjRoleSkill( bsId: string) {
//   return request.post('/cljj/detail', { bsId })
// }

// export function saveClPvUv( url: string) {
//   return request.post('/cljj/savePvUv', { url })
// }

// export function saveMessageBoard( content: string) {
//   return request.post('/cljj/saveMessageBoard', { content })
// }

// export function messageList(pageNO: number, pageSize: number) {
//   return request.post('/cljj/messageList', { pageNO, pageSize })
// }

// export function strongestTeamDetail( id: string) {
//   return request.post('/cljj/strongestTeamDetail', { id })
// }

// 上传/导入 Excel
export function importData(param) {
  return request({
    url: '/cljj/importData',
    method: 'post',
    data: param,
    headers: { 'Content-Type': 'multipart/form-data;charset=utf-8' },
  })
}

export function getCljjList(pageNO: number, pageSize: number, name: string, attribute: string,serverResourceType: string) {
  return request({
    url: '/cljj/list',
    method: 'post',
    data: encrypt( { pageNO, pageSize,name,attribute,serverResourceType }),
    headers: { 'Content-Type': 'application/json' },
  })
}

export function getCljjRoleSkill( bsId: string) {
  return request({
    url: '/cljj/detail',
    method: 'post',
    data: encrypt(  { bsId }),
    headers: { 'Content-Type': 'application/json' },
  })
}

export function saveClPvUv( url: string) {
  return request({
    url: '/cljj/savePvUv',
    method: 'post',
    data: encrypt(  { url }),
    headers: { 'Content-Type': 'application/json' },
  })
}

export function saveMessageBoard( content: string) {
  return request({
    url: '/clai/saveMessageBoard',
    method: 'post',
    data: encrypt(  { content }),
    headers: { 'Content-Type': 'application/json' },
  })
}

export function messageList(pageNO: number, pageSize: number) {
  return request({
    url: '/clai/messageList',
    method: 'post',
    data: encrypt(  {  pageNO, pageSize  }),
    headers: { 'Content-Type': 'application/json' },
  })
}

export function strongestTeamDetail( id: string) {
  return request({
    url: '/cljj/strongestTeamDetail',
    method: 'post',
    data: encrypt(  { id  }),
    headers: { 'Content-Type': 'application/json' },
  })
}


export function strategy( id: string) {
  return request({
    url: '/cljj/strategy',
    method: 'post',
    data: encrypt(  { id  }),
    headers: { 'Content-Type': 'application/json' },
  })
}

// 装备库
export function getEquipmentList(pageNO: number, pageSize: number, equipmentName: string, attribute: string,markupType: string) {
  return request({
    url: '/cljj/equipment',
    method: 'post',
    data: encrypt( { pageNO, pageSize,equipmentName,attribute,markupType}),
    headers: { 'Content-Type': 'application/json' },
  })
}

// 攻略板块
export function strategyContentList(strategyId: string) {
  return request({
    url: '/cljj/strategyContent',
    method: 'post',
    data: encrypt( { strategyId }),
    headers: { 'Content-Type': 'application/json' },
  })
}

// 苍蓝数据地图
export function playerDistributionList(id: string) {
  return request({
    url: '/cljjMap/playerDistribution',
    method: 'post',
    data: encrypt( { id }),
    headers: { 'Content-Type': 'application/json' },
  })
}

// 苍蓝卡池配置
export function cardPoolList(id: string,isAll: string) {
  return request({
    url: '/cljj/cardPool',
    method: 'post',
    data: encrypt( { id,isAll }),
    headers: { 'Content-Type': 'application/json' },
  })
}


// 抽卡
export function drawCard(poolId: number, drawType: number) {
  return request({
    url: '/cljj/drawCard',
    method: 'post',
    data: encrypt( { poolId, drawType}),
    headers: { 'Content-Type': 'application/json' },
  })
}
